load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")

go_library(
    name = "tidb-lightning_lib",
    srcs = ["main.go"],
    importpath = "github.com/pingcap/tidb/lightning/cmd/tidb-lightning",
    visibility = ["//visibility:private"],
    deps = [
        "//lightning/pkg/server",
        "//lightning/pkg/web",
        "//pkg/lightning/common",
        "//pkg/lightning/config",
        "//pkg/lightning/log",
        "//pkg/util/memory",
        "@org_uber_go_zap//:zap",
    ],
)

go_binary(
    name = "tidb-lightning",
    embed = [":tidb-lightning_lib"],
    visibility = ["//visibility:public"],
)

go_test(
    name = "tidb-lightning_test",
    timeout = "short",
    srcs = ["main_test.go"],
    embed = [":tidb-lightning_lib"],
    flaky = True,
)
